<template>
  <div>about</div>
</template>

<script setup>
import $ajax from '../api'

// import { get } from '../api'

const loaddata = async function () {
  const path = '/topnews/index?key=c65cff44e82fc3b1d27622e80e0a1b6c'

  const data = await $ajax.get(path)

  console.log(data)
}

loaddata()

// 初次封装代码
// import $ajax from '../api'
// $ajax
//   .get('/topnews/index?key=c65cff44e82fc3b1d27622e80e0a1b6c')
//   .then((response) => {
//     console.log(response)
//   })
//   .catch((error) => {
//     console.log(error)
//   })
// 原生代码
// import axios from 'axios'
// axios
//   .get('https://apis.tianapi.com/topnews/index1?key=c65cff44e82fc3b1d27622e80e0a1b6c')
//   .then((response) => {
//     console.log(response)
//   })
//   .catch((error) => {
//     console.log(error)
//   })
</script>

<style lang="scss" scoped></style>
